package com.wc.alorithm_blue_bridge._数学知识.质数.质数;

import java.util.Scanner;

/**
 * @Author congege
 * @Description
 *
 * @Date Created in 2023/11/24-20:32
 */
public class Main2 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int maxN = 15485863;
        boolean[] st = new boolean[maxN + 1];
        int[] primes = new int[1000000 + 1];
        int idx = 1;
        for (int i = 2; i <= maxN; i++) {
            if (!st[i]) {
                primes[idx++] = i;
            }
            for (int j = 1; primes[j] * i <= maxN ; j++) {
                st[primes[j] * i] = true;
                if (i % primes[j]==0){
                    break;
                }
            }
        }
        int n = sc.nextInt();
        while (n-- > 0){
            int index = sc.nextInt();
            System.out.println(primes[index]);
        }
    }
}
